<?php
/**
 * 员工
*/
apf_require_class('APF_Controller');
apf_require_class('Bll_Hr_OutInterface');

class Hr_User_ApiController extends APF_Controller {

    public function handle_request() {
        $request = APF::get_instance()->get_request();
        $params = $request->get_parameters();
        $type=$params['type'];

        $api = new Bll_Hr_OutInterface();
        $data = array();
        switch($type){
            case 'GetAllUser'://获取所有用户的user_id,job_status
                $data = $api->search_all_user();
                break;
            case 'GetUserByUids'://得的用户基本信息
                $tmp_uids = $params['uids'];
                if(!empty($tmp_uids)){
                    $uids = explode(',',$tmp_uids);
                }
                $data = $api->get_user_by_ids($uids);
                break;
            case 'SearchDepartment'://取出所有的部门信息
                $data = $api->search_department();
                break;
            case 'SearchRelation'://查询员工上级关系
                $tmp_uids = $params['uids'];
                if(!empty($tmp_uids)){
                    $uids = explode(',',$tmp_uids);
                }
                $data = $api->get_user_relation($uids);
                break;
            case 'SearchDepartmentManager':
                //不使用
                /*$depid = $params['depid'];
                if(!empty($depid)){
                    $data = $api->get_department_manage($depid);
                }*/
            default :
                break;
        }
        echo json_encode($data);exit;
    }
}